<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者，助力中小企业发展
// +----------------------------------------------------------------------
// | Copyright (c) 2017～2024  www.wdadmin.cn    All rights reserved.
// +----------------------------------------------------------------------
// | Wdadmin系统产品软件并不是自由软件，不加密，并不代表开源，未经许可不可自由转售和商用
// +----------------------------------------------------------------------
// | Author: MY WORLD Team <bd@maiwd.cn>   www.wdadmin.cn
// +----------------------------------------------------------------------

/**
 * Class Options
 * Desc  评价选项控制器
 * Create on 2024/10/25 17:39
 * Create by wangyafang
 */
namespace app\api\controller\wddj\user\evaluation;
use app\common\controller\Api;

class Options extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];
    protected $model = null;

    public function _initialize()
    {
        parent::_initialize();
        $this->model = new \app\api\model\wddj\user\evaluation\Options();
    }

    /**
     * Desc 评价选项
     * Create on 2024/10/25 17:41
     * Create by wangyafang
     */
    public function index()
    {
        if (!$this->request->isGet()) {
            $this->error('请求类型错误');
        }

        $order = 'weigh desc,id desc';

        $data = array(
            'satisfied'=>$this->model
                ->where('satisfaction_status',1)
                ->field("id,content")
                ->order($order)
                ->select(),
            'dissatisfied'=>$this->model
                ->where('satisfaction_status',2)
                ->field("id,content")
                ->order($order)
                ->select()
        );

        $this->success('请求成功',$data);
    }
}



 